<?php
session_start();
ob_start('ob_gzhandler');
include_once('config.php');

if(@$_GET['danhmuc']){
	$dm = $_GET['danhmuc'];
	$dm = explode('/',$dm);
	$danhmuc = $dm[0];
	if($dm[1]=='') $page = 1; else $page = $dm[1];
	$menu_one = $tc->menu_one($danhmuc);
	$row_menu_one = mysql_fetch_array($menu_one);
	$idMenu = $row_menu_one['id'];
	$type = $row_menu_one['type_id'];
	$slogan = "<h6>{$row_config['slogan']}</h6>";
	if(!@$_GET['detail']){
		$navigator = '<div class="title"><h1>'.$row_menu_one['title'].'</h1></div>';
		($row_menu_one['url_hinh']=='') ? $image='http://'.$domain.'/'.url_default_image : $image='http://'.$domain.'/'.url_danhmuc_image.$row_menu_one['url_hinh'];
		$url = 'http://'.$domain.'/'.$row_menu_one['url'];
		$seo = $tc->seo($domain,$row_menu_one['title'],$row_menu_one['metaDescription'],$row_menu_one['metaKeyword'],$image,$url);
		switch($type){
			case 2 : include_once('blocks/list_articles.php'); break;
			case 3 : include_once('blocks/list_product.php'); break;
			case 7 : include_once('blocks/contact.php'); break;
			default: $view_post = '<font color="#FF0000"><b>Could not be found</b></font>';
		}
	}else{
		$dt = $_GET['detail'];
		$detail = $tc->detail($dt);
		$row_detail = mysql_fetch_array($detail);
		($row_detail['url_hinh']!='') ? $image='http://'.$domain.'/'.url_detail_thumb_image.$row_detail['url_hinh'] : $image='http://'.$domain.'/'.url_default_image;
		$url = 'http://'.$domain.'/'.$row_menu_one['url'].$row_detail['name_rewrite'].'.html';
		$seo = $tc->seo($domain,$row_detail['name'],$row_detail['description'],$row_detail['metaKeyword'],$image,$url);
		include_once('blocks/articles.php');
	}
}else{
	$menu_one = $tc->menu_one('trang-chu');
	$row_menu_one = mysql_fetch_array($menu_one);
	$url = 'http://'.$domain;
	($row_menu_one['url_hinh']=='') ? $image='http://'.$domain.'/'.url_default_image : $image='http://'.$domain.'/'.url_danhmuc_image.$row_menu_one['url_hinh'];
	$seo = $tc->seo($domain,$row_menu_one['title'],$row_menu_one['metaDescription'],$row_menu_one['metaKeyword'],$image,$url);
	$slogan = "<h1>{$row_config['slogan']}</h1>";
	include_once('blocks/home.php');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php echo $seo; ?>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="library/jquery.js"></script>
<script type="text/javascript" src="library/jquery.corner.js"></script>
<script type="text/javascript" src="website.js"></script>
</head>

<body>

<div id="wrapper">
	<div id="header">
    	<div id="logo"><a href="" title="Stevbros Training"><img src="images/logo.png" alt="Stevbros Training" /></a></div>
        <div id="top">
        	<div id="menu_top">
            <?php
            $top = $tc->menu(0,1);
			while($row_top = mysql_fetch_array($top)){
				$view_top .= '<a href="'.$row_top['url'].'" title="'.$row_top['title'].'">'.$row_top['name'].'</a>';
			}
			echo $view_top;
			?>
            </div>
            <div id="lang"><a href="" title="English"><img src="images/en.jpg" alt="English" /></a><a href="" title="Việt Nam"><img src="images/vi.jpg" alt="Việt Nam" /></a></div>
        </div>
        <div id="logopmp"><a href="http://www.pmi.org" title="Project Management Institute - PMI" target="_blank"><img src="images/REP_color.png" alt="logo pmp" /></a></div>
    </div>
	<?php include_once('blocks/menu.php');?>
    <div id="content">
		<div id="left">
        	<?php echo $view_post;?>
        </div>
        <?php include_once('blocks/right.php');?>
        <div style="clear:both; height:1px"></div>
    </div>
	<div id="footer">
    	<div class="left">Copyright @ 2013 Stevbros, Ltd</div>
        <div class="right">PMI, PMBOK, PMP, CAPM, PgMP, PMI-ACP are registered marks of the Project Management Institute, Inc</div>
    </div>

</div>


</body>
</html>
<?php mysql_close();?>